<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title></title>
  </head>
  <body>
    <div id="app">
      <div>{{ state.count }}</div>
    </div>

    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>

    <script>
      const { createApp, reactive, nextTick } = Vue;

      const app = createApp({
        setup() {
          const state = reactive({ count: 0 });

          setTimeout(async () => {
            state.count++;
            console.log(+new Date());
            await nextTick();
            console.log(+new Date());
            console.log("DOM 已经更新了");
          }, 1000);

          return {
            state,
          };
        },
      });

      app.mount("#app");
    </script>
  </body>
</html>
